To Do list for improving code idioms
####################################

To Do
=====

* Ensure all files explicitly opened are closed correctly.

* Encapsulate application state in a class.

  * dput.dput.PackageUploadApplication
  * dput.dcut.CommandUploadApplication

* Reduce ‘if __name__ == '__main__'’ block to minimum.

* Use idiomatic ‘configparser’ processing.

  * Migrate to ‘ConfigParser.read’ method.
  * Remove direct query to ‘DEFAULT’ config section.

* Use ‘str.format’ for all string formatting and interpolation.

  * Remove usage of ‘%’ formatting operator.

* Use ‘argparse’ for command-line parsing.

  * Remove usage of ‘getopt’.

* Use ‘logging’ module throughout for all messages.

  * Remove usage of ‘print’ for debug-level messages.
  * Remove usage of ‘print’ for Informational messages.
  * Remove usage of ‘print’ for warning message.
  * Remove usage of ‘print’ for error messages.
  * Remove usage of ‘print’ for critical error messages.

* Use ‘sys.stdout.write’ for all normal output.

  * Remove usage of ‘print’ for normal output.

* Use a Python native SSH library (e.g. Paramiko or Spur).

  * Remove usage of subprocess for SSH.

* Use a Python native GnuPG library (e.g. ‘python-gnupg’).

  * Remove usage of subprocess for GnuPG.


Done
====

* Remove use of global variables.

  * dput.dcut.progname
  * dput.dcut.version
  * dput.dcut.USAGE
  * dput.dput.dput_version
  * dput.dput.files_to_remove
  * dput.dput.files_to_upload
  * dput.dput.USAGE
  * dput.dput.config_file
  * dput.dput.config
  * dput.dput.check_only
  * dput.dput.dinstall
  * dput.dput.delay_upload
  * dput.dput.unsigned_upload
  * dput.dput.simulate
  * dput.dput.upload_methods

* Use ‘subprocess’ API for all subprocess interaction.

  * Remove usage of ‘os.popen3’.
  * Migrate ‘os.system’ → ‘subprocess.call’.
  * Migrate ‘os.waitpid’ → ‘subprocess.check_call’.
  * Migrate ‘os.popen’ → ‘subprocess.Popen’.
  * Migrate ‘os.spawnv’ → ‘subprocess.check_call’.


..
    Local variables:
    coding: utf-8
    mode: text
    mode: rst
    End:
    vim: fileencoding=utf-8 filetype=rst :
